<template>
	<view class="container index">
		<view class="header" :style="isTop?'':'background-color: #F6F7F8; display:none;'">
			<image class="logo" :src="appData.applicationLogo" mode="widthFix"></image>
		</view>
		
		<!-- <view class="header" :style="isTop?'display: none;':'background-color: #FFFFFF; '">
			
		</view> -->
		<!-- <div class="header_blank" :style="{paddingTop:pattdingtop}"></div> -->
		<!-- 小程序头部兼容 -->
		<!-- #ifdef MP||H5 -->
		<view :class="isTop?'mp-search-box':'op-search'" id="sosuo" :style="isTop?'':'padding-top: '+(pattdingtop-3)+'px'">
			<image class="icon" src="/static/search_icon.png" :style="isTop?'':'top: '+(pattdingtop-3)+'px'" />
			<input class="ser-input" type="text" value="输入关键字搜索" disabled @click="navSearch"/>
		</view>
		<view class="mp-search-box-blank"></view>
		<!-- #endif -->

		<!-- 头部轮播 -->
		<view class="carousel-section">
			<!-- 标题栏和状态栏占位符 -->
			<view class="titleNview-placing"></view>
			<!-- 背景色区域 -->
			<view class="titleNview-background" style="background:#E37A64"></view>
			<swiper :autoplay="true" :interval="2000" class="carousel" circular @change="swiperChange">
				<swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item" @click="navSwiper(item)">
					<image :src="item.url" />
				</swiper-item>
			</swiper>
			<!-- 自定义swiper指示器 -->
			<view class="swiper-dots" v-if="carouselList.length>0">
				<text class="num">{{swiperCurrent+1}}</text>
				<text class="sign">/</text>
				<text class="num">{{swiperLength}}</text>
			</view>
		</view>
		
		
		<!-- 会员俱乐部，加入有惊喜 -->
		<view class="club"  style="margin-top: 20upx; height: 400upx;">
			<view class="bg"><image  mode="widthFix" src="https://api.zhaimejia.cn/miniStatic/bg2.png"></image></view>
			<!-- <view class="t">成为会员，抢免费商品</view> -->
			<view class="subs"><text>
				<image class="icon" mode="widthFix" src="/static/day_icon1.png"></image>
				<!-- 每日特惠 -->
				</text><text><image class="icon" mode="widthFix" src="/static/day_icon1.png"></image>
				<!-- 生日特惠 -->
				</text></view>
				
			<view class="btn" @click="navPoint" style="background-color: none;">
				<!-- GO <image src="/static/more_icon2.png" mode="aspectFill"></image> -->
			</view>
			
			<!-- <scroll-view class="list" scroll-x>
				<view class="scoll-wrapper">
					<view v-for="(item, index) in goodsList1" :key="index" class="item" @click="navToDetailPage2(item)">
						<image v-if="item.productMainImage" :src="item.productMainImage.url" mode="aspectFill"></image>
						<view class="name">{{item.productName}}</view>
						<view class="spec">{{item.memo}}</view>
						<view class="price">￥{{item.unitPoint}}</view>
					</view>
				</view>
			</scroll-view> -->
		</view>
		
		
		<!-- Shiru免费设计服务，打造理想的家 -->
		<view class="service">
			<view class="t">全屋定制，VIP会员专享免费设计服务</view>
			<view class="subs">
				<!-- 专业设计，有只家居用品 -->
			</view>
			<view class="con">
				<view class="left" @click="toTiJiao('全屋设计')">
					<image :src="sheJiLanMu[0].catePicUrl" class="pic" mode="aspectFill"></image>
					<view class="text">
						<image :src="sheJiLanMu[0].iconPicUrl" mode="aspectFill" class="icon"></image>
						<view class="name">{{sheJiLanMu[0].title}}</view>
					</view>
				</view>
				<view class="right">
					<view class="item" @click="toTiJiao('厨房')">
						<image :src="sheJiLanMu[1].catePicUrl" class="pic" mode="aspectFill"></image>
						<view class="text">
							<image :src="sheJiLanMu[1].iconPicUrl" mode="aspectFill" class="icon"></image>
							<view class="name">{{sheJiLanMu[1].title}}</view>
						</view>
					</view>
					<view class="item" @click="toAppointment">
						<image :src="sheJiLanMu[2].catePicUrl" class="pic" mode="aspectFill"></image>
						<view class="text">
							<image :src="sheJiLanMu[2].iconPicUrl" mode="aspectFill" class="icon"></image>
							<view class="name">{{sheJiLanMu[2].title}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<!-- 礼遇新人 -->
		<!-- <view class="giftbox">
			<view class="t">礼遇新人</view>
			<view class="con"><image src="https://api.zhaimejia.cn/miniStatic/gift.png" mode="widthFix"></image></view>
		</view> -->
		<!-- 直播间 -->
		<!-- <view class="online">
			<view class="t">
				直播间
				<view class="more" @click="navLiveRooms">MORE <image src="/static/more_icon.png" mode="aspectFill"></image></view>
			</view>
			<scroll-view class="list" scroll-x>
				<view class="scoll-wrapper">
					<view v-for="(item, index) in 4" :key="index" class="item" >
						<image src="" mode="aspectFill"></image>
						<view class="name">45°高密度优质海绵座包</view>
					</view>
				</view>
			</scroll-view>
		</view> -->
		<!-- 家，能量无限 -->
		<view class="family">
			<view class="bg"><image mode="widthFix" src="https://api.zhaimejia.cn/miniStatic/family_bg.png"></image></view>
			<view class="t">家，能量无限</view>
			<view class="subs">在家度假，为生活充能</view>
			<scroll-view class="list" scroll-x>
				<view class="scoll-wrapper">
					<!-- <view class="item"  @click="navLiveRooms()">
						<image :src="iconImglis[0]" mode="widthFix"></image>
					</view> -->
					<!-- <view class="item" @click="navGroupBuy">
						<image :src="iconImglis[1]" mode="widthFix"></image>
					</view> -->
					<view class="item" @click="navPoint">
						<image :src="iconImglis[2]" mode="widthFix"></image>
					</view>
					
					<view class="item"  @click="navSign">
						<image :src="iconImglis[3]" mode="widthFix"></image>
					</view>
					<!-- <view class="item" @click="navMerchant">
						<image :src="iconImglis[1]" mode="widthFix"></image>
					</view> -->
					<!-- <view class="item" @click="navSecKill">
						<image :src="iconImglis[2]" mode="widthFix"></image>
					</view> -->
					<!-- <view class="item" @click="navGroupBuy">
						<image :src="iconImglis[3]" mode="widthFix"></image>
					</view>
					<view class="item" @click="navSign">
						<image :src="iconImglis[4]" mode="widthFix"></image>
					</view> -->
				</view>
			</scroll-view>
		</view>

		
		

		<!-- 室内 -->
		<!-- <view class="part">
			<view class="t">探索房间的故事</view>
			<view class="subs">从房间开始，谱写家的故事</view>
			<view class="top" @click="navToProduct(fangjianlanmu[0].productcateUuid)">
				<image :src="fangjianlanmu[0].catePicUrl" class="pic" mode="aspectFill"></image>
				<view class="text">
					<view class="name">{{fangjianlanmu[0].title}}</view>
					<image src="/static/part_icon.png" mode="aspectFill" class="icon"></image>
				</view>
			</view>
			<view class="list">
				<view class="item" @click="navToProduct(fangjianlanmu[1].productcateUuid)">
					<image :src="fangjianlanmu[1].catePicUrl" mode="aspectFill"></image>
					<view class="name">{{fangjianlanmu[1].title}}</view>
				</view>
				<view class="item" @click="navToProduct(fangjianlanmu[2].productcateUuid)">
					<image :src="fangjianlanmu[2].catePicUrl" mode="aspectFill"></image>
					<view class="name">{{fangjianlanmu[2].title}}</view>
				</view>
				<view class="item" @click="navToProduct(fangjianlanmu[3].productcateUuid)">
					<image :src="fangjianlanmu[3].catePicUrl" mode="aspectFill"></image>
					<view class="name">{{fangjianlanmu[2].title}}</view>
				</view>
			</view>
		</view> -->
		<!-- 名店街-品牌家具 -->
		<view class="brand">
			<view class="t">
				名店街
				<view class="more" @click="navMerchant">更多 <image src="/static/more_icon.png" mode="aspectFill"></image></view>
			</view>
			<scroll-view class="list" scroll-x>
				<view class="scoll-wrapper " >
					<view v-for="(item, index) in shoumerchantList" v-if="item.logo" :key="index" class="item" style="height: 300upx;" @click="gomerchat(item)">
						<image :src="item.logo"  mode="aspectFill"></image>
						<!-- <text class="name">{{item.merchantName}}</text> -->
					</view>
				</view>
			</scroll-view>
		</view>
		
		
		
		
		<!-- 猜你喜欢  根际地位推荐-->
		<view class="like">
			<view class="t">
				<view :class="['t_item', isonly==index ? 't_only' : '']" v-for="(item,index) in navlist" :key="index" @click="only(index)">
					{{item}}
				</view>
			</view>
			<!-- 关注 -->
			<view class="lists"  v-for="(merchant, index) in followedMerchantList" v-if="merchant.logo && isonly===0">
				<view  class="item" @click="gomerchat(merchant)">
					<image :src="merchant.logo" mode="aspectFill" style="height: 400upx; border-radius: 10upx; margin-bottom: -10upx;"></image>
				</view>
			</view>
			<!-- 推荐---猜你喜欢 -->
			<view class="lists"  v-for="group in productGroups" v-if="isonly===1">
				<view  class="item" @click="navToDetailPage(product)" v-for="product in group.productList">
					<view class="in">
						<view class="pic">
							<image :src="product.productMainImage.url" mode="aspectFill"></image>
						</view>
						<view class="name">{{product.productName}}</view>
						<view class="name">{{product.merchantName}}</view>
						<view class="price">￥{{product.unitPrice}}</view>
					</view>
				</view>
			</view>
			<!-- 附件---附近 -->
			<view class="lists"  v-for="product in guessData" v-if="isonly===2">
				<view  class="item" @click="navToDetailPage(product)">
					<view class="in">
						<view class="pic">
							<image :src="product.productMainImage.url" mode="aspectFill"></image>
						</view>
						<view class="name">{{product.productName}}</view>
						<view class="price">￥{{product.unitPrice}}</view>
					</view>
				</view>
			</view>
			<!-- 达人探店---直播 -->
			<view class="lists" v-if="isonly===3">
				<view class="myCon" v-for="(item,index) in msg" :key="index" @click="navToDetail(item.articleUuid)">
					<view class="img">
						<image class='image' :src="item.coverImageUrl" mode="aspectFill"></image>
					</view>
					<view class="text">
						{{item.title}}
					</view>
				</view>
				<!-- <view  class="item" @click="navToDetailPage(product)">
					<view class="in">
						<view class="pic">
							<image :src="product.productMainImage.url" mode="aspectFill"></image>
						</view>
						<view class="name">{{product.productName}}</view>
						<view class="price">￥{{product.unitPrice}}</view>
					</view>
				</view> -->
			</view>
			
			<!-- <u-loadmore :status="status" /> -->
		</view>
		
		
		
		
		
		<!-- 猜你喜欢 -->
		<!-- <view class="like" v-for="group in productGroups" v-if="productGroups.length>0 && group.groupName && group.groupName=='猜你喜欢' && group.productList.length>0">
			<view class="t">猜你喜欢</view>
			<view class="lists">
				<view  v-for="product in group.productList" class="item" @click="navToDetailPage(product)">
					<view class="in">
						<view class="pic">
							<image :src="product.productMainImage.url" mode="aspectFill"></image>
						</view>
						<view class="name">{{product.productName}}</view>
						<view class="name">{{product.merchantName}}</view>
						<view class="price">￥{{product.unitPrice}}</view>
					</view>
				</view>
			</view>
		</view> -->
	</view>
</template>

<script>
	import uniGrid from "@/components/uni-grid/uni-grid.vue"
	import uniGridItem from "@/components/uni-grid-item/uni-grid-item.vue"
	import uniBadge from '@/components/uni-badge/uni-badge.vue'
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {
		components: {
			uniGrid,
			uniGridItem,
			uniBadge
		},
		data() {
			return {
				titleNViewBackground: '',
				swiperCurrent: 0,
				swiperLength: 0,
				carouselList: [],
				cates: [],
				secKills: [],
				secKillCountDown: {},
				groupBuys: [],
				productGroups: [],
				ads: [],
				notice:[],
				announcement:[],
				articleList: []	,//图文, 音视频列表
				secKillFlag:'END',//秒杀结束标志符(END表示已结束)
				current: 0,	//默认展示推荐商品
				total: 0,
				pageSize: 10,
				pageNo: 1,
				loadingType: 'more', //加载更多状态
				goodsList1:[],
				goodsList:[],
				showGift:false,	//新人礼物弹窗
				giftList:[],
				receiveLoading:false,
				receiveGiftMessage:'',
				merchantList:[],
				pattdingtop:0,
				iconImglis:[],
				sheJiLanMu:[],
				fangjianlanmu:[],
				isTop:true,
				appData:"",
				shoumerchantList:"",
				latitude:"",
				longitude:"",
				guessData:[],
				guessPage:0,
				status:"loadmore",
				totalni:"",
				navlist:['关注','猜你喜欢','附近','达人探店'], //猜你喜欢导航列表
				isonly: 0,
				followedMerchantList:[], //关注的商家
				msg:[]
			};
		},
		computed: {
			...mapState(['hasLogin', 'userInfo', 'footPrint', 'applicationConfig','currentCity'])
		},
		onLoad() {
			// this.loadData();
			this.iPhone()
			this.getGlobalApplicationSetting()
			
			this.getIndexCateSettingList(1)
			this.getIndexCateSettingList(2)
			
			this.getGuessYouLikeIt();
			

			
			
		},
		mounted() {
			console.log('直播内容',this.msg)
			//获取右上角胶囊按钮布局信息
			let res=wx.getMenuButtonBoundingClientRect()
			// console.log(res)
			this.pattdingtop=res.top
			
			// const query = uni.createSelectorQuery().in(this);
			// query.select('#sosuo').boundingClientRect(data => {
			// 	console.log(data.height)
			// }).exec();
		},
		onPageScroll(scroll){  //监听滚动
			if(scroll.scrollTop >300){
				this.isTop=false;
				
			}else{
				this.isTop=true;
				
			}
		},
		onShow(){
			this.loadData();
			if(this.hasLogin && !this.userInfo.profitWelfareReceived){
				this.receiveGiftMessage = '';
				this.inquiryProfitWelfare();
			}
			this.inquiryFollowedMerchant()
			console.log('关注的商家',this.merchantList)
		},
		onHide() {
			clearInterval(this.timer)
			this.timer=null
		},
		//加载更多
		onReachBottom(){
			this.status = 'loading';

			this.guessPage = ++ this.guessPage;
			
			console.log(this.totalni)
			console.log(this.guessData.length)
			
			if(this.totalni<=this.guessData.length || (this.guessData.length+4) >= this.totalni || this.guessData.length>30){
				 this.status = 'nomore';
			}else {
				this.getSearchMerchant(this.guessPage);
			}
			
		},
		onShareAppMessage: function (e) {
		    var title = '家居大众点评';
		    var imageUrl = 'https://api.zhaimejia.cn/miniStatic/share.jpg';
		    var path= ''
		    
		    let obj = {
		      title,
		      imageUrl,
		      path: path,
		      success: function (res) {
		        console.log('点击页面内的分享按钮--onShareAppMessage分享成功', res)
		      },
		      fail(err) {
		        console.log('点击页面内的分享按钮--onShareAppMessage-fail', err)
		      }
		    }
		    return obj
		  },
		  onShareTimeline: function(res){
		    var title = '家居大众点评';
		    var imageUrl = 'https://api.zhaimejia.cn/miniStatic/share.jpg';
		    var path= ''
		    
		    let obj = {
		      title,
		      imageUrl,
		      path: path,
		      success: function (res) {
		        console.log('点击页面内的分享按钮--onShareAppMessage分享成功', res)
		      },
		      fail(err) {
		        console.log('点击页面内的分享按钮--onShareAppMessage-fail', err)
		      }
		    }
		    return obj
		},
		onShareAppMessage: function (e) {
		    var title = '家居大众点评';
		    var imageUrl = 'https://api.zhaimejia.cn/miniStatic/share.jpg';
		    var path= ''
		    
		    let obj = {
		      title,
		      imageUrl,
		      path: path,
		      success: function (res) {
		        console.log('点击页面内的分享按钮--onShareAppMessage分享成功', res)
		      },
		      fail(err) {
		        console.log('点击页面内的分享按钮--onShareAppMessage-fail', err)
		      }
		    }
		    return obj
		  },
		  onShareTimeline: function(res){
		    var title = '家居大众点评';
		    var imageUrl = 'https://api.zhaimejia.cn/miniStatic/share.jpg';
		    var path= ''
		    
		    let obj = {
		      title,
		      imageUrl,
		      path: path,
		      success: function (res) {
		        console.log('点击页面内的分享按钮--onShareAppMessage分享成功', res)
		      },
		      fail(err) {
		        console.log('点击页面内的分享按钮--onShareAppMessage-fail', err)
		      }
		    }
		    return obj
		},
		methods: {
			// 获取分类
			getinquiryTag(){
				this.$api.request.articleList({tagDTO:{
						tagName: "直播内容"
					},
					startIndex:0,
					pageSize:10}, (res)=> {
						console.log('直播内容',res)
					if (res.body.status.statusCode === '0') {
						this.msg=res.body.data.articles;
						console.log(this.msg)
					}
				})
			},
			//新闻详情
			navToDetail(item){
				
				uni.navigateTo({
					url:'/pages/content/videoDetails?id='+item
				})
			},
			only(index) {
				this.isonly = index
				if(index===3){
					//获取直播列表
					this.getinquiryTag()
				}
			},
			iPhone(){
			    let that=this;
			    uni.getSystemInfo({
			      success:  function (res)  {
			      let model = res.model;
			      if (model.search('iPhone X') != -1 || model.search('iPhone 11') != -1) {
			        that.pattdingtop = '22px'
			       }
			      },
			    })
			},
			gomerchat(item){
				let id = item.merchantUuid;
				uni.navigateTo({
					url: `/pages/merchant/detail?id=${id}`
				})
			},
			// change(index) {
			// 	this.current = index;
			// 	this.resetPage();
			// 	if(index==0){
			// 		this.searchRecommendProduct();
			// 	}else{
			// 		this.searchProductByCate(this.cates[index].productCateUuid);
			// 	}
			// },
			//重置商品及分页
			resetPage(){
				this.pageNo = 1;
			},
			/**
			 * 请求静态数据只是为了代码不那么乱
			 * 分次请求未作整合
			 */
			async loadData() {
				// this.inquirySwiper();
				// this.inquiryAd();
				// this.inquiryProductCate();
				// this.inquirySecKill();
				// this.inquiryGroupBuy();
				// this.inquiryProductGroup();
				this.homeData();
				this.resetPage();
				// this.searchRecommendProduct();
				this.searchPointProduct();
				this.searchMerchant()
			},
			//搜索商品
			searchPointProduct(){
				let searchData = {
					'keyArray': [],
					'startIndex': 0,
					'pageSize': 5,
					'sortBy': 'updateDate',
					'sort': 'desc'
				};
				//加载中
				this.$api.request.pointGoodsList(searchData, res => {
					uni.stopPullDownRefresh();
					if (res.body.status.statusCode === '0') {
						var goodsList1 = res.body.data.products;
						this.goodsList1 = this.goodsList1.concat(goodsList1);
					}
				},true);
			},
			//查询商家列表
			searchMerchant() {
				let that = this;
				var postData = {
					startIndex: 0,
					pageSize: 10
				}
				console.log("名店街")
				this.$api.request.merchantList(postData, res => {
					if (res.body.status.statusCode === '0') {
						var merchantList = [];
						res.body.data.merchants.forEach(function(val,index){
							if(val.latitude && val.longitude){
								//计算离当前位置距离
								var distance = that.$api.util.getDistance(that.latitude, that.longitude,val.latitude,val.longitude);
								val.distance = distance;
								if(val.score){
									val.score = val.score.toFixed(1);
								}else{
									val.score = 0
								}
								merchantList.push(val);
							}
						})
						this.shoumerchantList=merchantList
						this.merchantList = this.merchantList.concat(merchantList);
						// console.log(this.merchantList)
						// this.merchantList = merchantList
						this.total = res.body.data.total;
			
					}
				},true);
			},
			//查询关注的商家列表
			inquiryFollowedMerchant() {
				let that = this;
				let time=300
				var postData = {
					userUuid: this.userInfo.userUuid
				}
				this.timer=null
				clearTimeout(this.timer)
				if(!this.userInfo.userUuid){
				    that.timer=setTimeout(()=>{
						that.inquiryFollowedMerchant()
					},time)
				}
				console.log("this.userInfo.userUuid",this.userInfo.userUuid)
				if(this.userInfo.userUuid != null){
					this.loadingType = 'loading';
					this.$api.request.followedMerchant(postData, res => {
						this.loadingType = 'noMore';
						if (res.body.status.statusCode === '0') {
							var merchantList = [];
							res.body.data.merchants.forEach(function(val,index){
								if(val.latitude && val.longitude){
									//计算离当前位置距离
									var distance = that.$api.util.getDistance(that.latitude, that.longitude,val.latitude,val.longitude);
									val.distance = distance;
									if(val.score){
										val.score = val.score.toFixed(1);
									}else{
										val.score = 0
									}
									merchantList.push(val);
								}
							})
							//this.merchantList = merchantList;
							this.followedMerchantList = merchantList;
						} else {
							this.$api.msg(res.body.status.errorDesc);
						}
					},true);
				}else{
					//this.merchantList = [];
					this.followedMerchantList = [];
				}
				
			},
			//查询新人福利
			inquiryProfitWelfare() {
				this.$api.request.inquiryProfitWelfare({}, res => {
					if (res.body.status.statusCode === '0') {
						this.giftList = res.body.data.welfares;
						//有待领取新人福利, 打开领取弹窗
						if(this.giftList.length>0)
							this.showGift = true;
					} else {
						console.log(res.body.status.errorDesc);
					}
				},true);
			},
			//领取新人福利
			receiveProfitWelfare() {
				this.receiveLoading = true;
				this.$api.request.receiveProfitWelfare({
					userUuid:this.userInfo.userUuid
				}, res => {
					this.receiveLoading = false;
					if (res.body.status.statusCode === '0') {
						this.$api.msg('领取成功');
						this.receiveGiftMessage = '';
						this.showGift = false;
						//标记新人福利已领取
						this.userInfo.profitWelfareReceived = true;
					} else {
						this.receiveGiftMessage = res.body.status.errorDesc
					}
				});
			},
			//轮播图
			// inquirySwiper() {
			// 	this.$api.request.slider({}, res => {
			// 		if (res.body.status.statusCode === '0') {
			// 			this.carouselList = res.body.data.swipers;
			// 			this.swiperLength = this.carouselList.length;
			// 			// this.titleNViewBackground = this.carouselList[0].background;
			// 		} else {
			// 			console.log(res.body.status.errorDesc);
			// 		}
			// 	});
			// },
			//首页数据
			homeData() {
				let that = this;
				this.$api.request.home({}, res => {
					if (res.body.status.statusCode === '0') {
						this.carouselList = res.body.data.swipers;
						this.swiperLength = this.carouselList.length;
						this.ads = res.body.data.ads;
						this.cates = [{cateName:'推荐'}].concat(res.body.data.cates);
						this.groupBuys = res.body.data.groupBuys;
						this.productGroups = res.body.data.groups;
						// console.log(11)
						// console.log(this.productGroups )
						
						this.secKills = res.body.data.secKills;
						//用最近的秒杀商品作为秒杀倒计时数据
						if (this.secKills.length > 0) {
							for(var i=0; i<this.secKills.length; i++){
								var endTimeStr = this.secKills[i].endTime;
								var endTime = new Date(Date.parse(endTimeStr.replace(/-/g, "/")));
								var startTimeStr = this.secKills[i].startTime;
								var startTime = new Date(Date.parse(startTimeStr.replace(/-/g, "/")));
								if(endTime>=new Date()){	//未开始或者秒杀中
									var diff = that.$api.util.getCountDownTimes(this.secKills[i].startTime);
									this.secKillCountDown = {
										days: diff[0],
										hours: diff[1],
										minutes: diff[2],
										seconds: diff[3]
									}
									this.secKillFlag = startTime<=new Date()?'START':'';
									break;
								}
							}
							// var endTimeStr = this.secKills[0].endTime;
							// var endTime = new Date(Date.parse(endTimeStr.replace(/-/g, "/")));
							// if(endTime<new Date()){
							// 	this.secKillFlag = 'END';
							// }else{
							// 	var diff = that.$api.util.getCountDownTimes(this.secKills[0].startTime);
							// 	this.secKillCountDown = {
							// 		days: diff[0],
							// 		hours: diff[1],
							// 		minutes: diff[2],
							// 		seconds: diff[3]
							// 	}
							// 	}
						}
					} else {
						console.log(res.body.status.errorDesc);
					}
				});
			},
			searchRecommendProduct(){
				var keyArray = [];
				keyArray.push('ON_SALE');
				keyArray.push('RECOMMEND');
				//选择了城市，只搜索该城市商品
				if(this.currentCity){
					keyArray.push('CITY');
				}
				let searchData = {
					'keyArray': keyArray,
					'onSale': true,
					'recommend': true,
					'city': this.currentCity,
					'startIndex': (this.pageNo-1)*this.pageSize,
					'pageSize': this.pageSize,
				};
				this.searchProduct(searchData);
			},
			searchProductByCate(productCateUuid){
				var keyArray = [];
				keyArray.push('ON_SALE');
				keyArray.push('PRODUCT_CATE');
				//选择了城市，只搜索该城市商家
				if(this.currentCity){
					keyArray.push('CITY');
				}
				let searchData = {
					'keyArray': keyArray,
					'onSale': true,
					'productCateUuid': productCateUuid,
					'city': this.currentCity,
					'startIndex': (this.pageNo-1)*this.pageSize,
					'pageSize': this.pageSize,
				};
				this.searchProduct(searchData);
			},
			//搜索商品
			searchProduct(searchData){
				//加载中
				this.loadingType = 'loading';
				this.$api.request.goodsList(searchData, res => {
					uni.stopPullDownRefresh();
					if (res.body.status.statusCode === '0') {
						var goodsList = res.body.data.products;
						if(this.pageNo === 1)
							this.goodsList = goodsList;
						else
							this.goodsList = this.goodsList.concat(goodsList);
						this.total = res.body.data.total;
						if(this.goodsList.length>=this.total){
							this.loadingType = 'noMore';
						}else{
							this.loadingType = 'more';
						}
					} else {
						this.loadingType = 'more';
						console.log(res.body.status.errorDesc);
					}
				},true);
			},
			//首页广告
			// inquiryAd() {
			// 	this.$api.request.advert({
			// 		location: '首页'
			// 	}, res => {
			// 		if (res.body.status.statusCode === '0') {
			// 			this.ads = res.body.data.ads;
			// 		} else {
			// 			console.log(res.body.status.errorDesc);
			// 		}
			// 	});
			// },
			//首页商品类目
			// inquiryProductCate() {
			// 	this.$api.request.homeProductCate({

			// 	}, res => {
			// 		if (res.body.status.statusCode === '0') {
			// 			this.cates = res.body.data.cates;
			// 		} else {
			// 			console.log(res.body.status.errorDesc);
			// 		}
			// 	});
			// },
			//首页秒杀商品
			// inquirySecKill() {
			// 	let that = this;
			// 	this.$api.request.secKill({

			// 	}, res => {
			// 		if (res.body.status.statusCode === '0') {
			// 			this.secKills = res.body.data.secKills;
			// 			//用最近的秒杀商品作为秒杀倒计时数据
			// 			if (this.secKills.length > 0) {
			// 				var diff = that.$api.util.getCountDownTimes(this.secKills[0].startTime);
			// 				this.secKillCountDown = {
			// 					days: diff[0],
			// 					hours: diff[1],
			// 					minutes: diff[2],
			// 					seconds: diff[3]
			// 				}
			// 			}
			// 		} else {
			// 			console.log(res.body.status.errorDesc);
			// 		}
			// 	});
			// },
			//首页团购商品
			// inquiryGroupBuy() {
			// 	let that = this;
			// 	this.$api.request.groupBuy({

			// 	}, res => {
			// 		if (res.body.status.statusCode === '0') {
			// 			this.groupBuys = res.body.data.groupBuys;
			// 		} else {
			// 			console.log(res.body.status.errorDesc);
			// 		}
			// 	});
			// },
			//首页首页商品组
			// inquiryProductGroup() {
			// 	let that = this;
			// 	this.$api.request.productGroup({

			// 	}, res => {
			// 		if (res.body.status.statusCode === '0') {
			// 			this.productGroups = res.body.data.groups;
			// 		} else {
			// 			console.log(res.body.status.errorDesc);
			// 		}
			// 	});
			// },
			//轮播图切换修改背景色
			swiperChange(e) {
				const index = e.detail.current;
				this.swiperCurrent = index;
				this.titleNViewBackground = this.carouselList[index].background;
			},
			//详情页
			navToDetailPage(item) {
				let id = item.productUuid;
				uni.navigateTo({
					url: '/pages/product/product?id='+id
				})
			},
			navToDetailPage2(item) {
				let id = item.productUuid;
				uni.navigateTo({
					url: '/pages/point/product-detail?id='+id
				})
			},
			//轮播图链接
			navSwiper(item) {
				this.$api.util.navSwiper(item);
			},
			//广告链接
			navAD(item) {
				this.$api.util.navAD(item);
			},
			//商品列表页
			navToGroupPage(group) {
				let groupId = group.groupUuid;
				uni.navigateTo({
					url: '/pages/product/group?groupId=' + groupId
				})
			},
			navToGroupPageid(id) {
				uni.navigateTo({
					url: '/pages/product/group?groupId=' + id
				})
			},
			//领券中心
			navCoupon(){
				uni.navigateTo({
					url: '/pages/coupon/list'
				})
			},
			//积分兑换
			navPoint(){
				uni.navigateTo({
					url: '/pages/point/product-list'
				})
			},
			//积分签到
			navSign(){
				if (!this.hasLogin) {
					uni.navigateTo({
						url: '/pages/public/login'
					})
				}else{
					uni.navigateTo({
						url: '/pages/point/sign'
					})
				}
			},
			//客服中心
			navCustomerService(){
				uni.navigateTo({
					url: '/pages/help/help'
				})
			},
			//选择城市
			navCity(){
				uni.navigateTo({
					url: '/pages/index/city'
				})
			},
			//附近门店
			navMerchant(){
				uni.navigateTo({
					url: '/pages/merchant/list'
				})
			},
			//直播间
			navLiveRooms(){
				uni.navigateTo({
					url: '/pages/live/room-list'
				})
			},
			//限时秒杀
			navSecKill(){
				uni.navigateTo({
					url: '/pages/product/seckillList'
				})
			},
			//秒杀详情页
			navSecKillDetail(item){
				let id = item.secKillProductUuid;
				uni.navigateTo({
					url: `/pages/product/seckill?id=${id}`
				})
			},
			//精品团购
			navGroupBuy(){
				uni.navigateTo({
					url: '/pages/product/groupbuyList'
				})
			},
			//团购详情页
			navGroupBuyDetail(item){
				let id = this.groupBuys[item].groupBuyProductUuid;
				uni.navigateTo({
					url: `/pages/product/groupbuy?id=${id}`
				})
			},
			//商品列表页
			navToList(tid) {
				uni.navigateTo({
					url: '/pages/product/list?cateId=' + tid
				})
			},
			//导航至官方资讯页面
			navAnnouncement: function() {
				var announcement = JSON.stringify(this.announcement);
				announcement = encodeURIComponent(announcement);
				uni.navigateTo({
					url: '/pages/notice/notice?data=' + announcement
				});
			},
			//跳转到发现页
			navFind: function(){
				console.log('发现页')
				uni.navigateTo({
					url:'/pages/content/index'
				})
			},
			//图文或音视频详情
			navToDetails(item){
				let url = '';
				if(item.articleType==='1' && item.linkType=='自定义内容')	
					url = '/pages/content/details?id='+item.articleUuid;
				if(item.articleType==='1' && item.linkType=='外部链接')
					url = '/pages/content/webView?src='+item.content;
				if(item.articleType==='2' || item.articleType==='3')
					url = '/pages/content/videoDetails?id='+item.articleUuid;
				uni.navigateTo({
					url:url
				})
			},
			//领取新人福利
			getNewMemberGift(){
				
				
			},
			//跳转到预约页面
			toAppointment(){
				uni.navigateTo({
					url:'/pages/appointment/index'
				})
			},
			//根际位置获取猜你喜欢
			getGuessYouLikeIt(){
				var that=this;
				uni.getLocation({
					type: 'gcj02',
					success: function(res) {
						console.log('当前位置的经度：' + res.longitude);
						console.log('当前位置的纬度：' + res.latitude);
						that.latitude = res.latitude;
						that.longitude = res.longitude;
						
						that.getSearchMerchant(that.guessPage);
					},
					complete: function(res) {
						//that.inquiryNearbyMerchant(res.latitude, res.longitude);
					}
				});
			},
			getSearchMerchant(page){
							
				
				var postData = {};
				
				postData.latitude = this.latitude;
				postData.longitude = this.longitude;
				postData.sortBy='distance'
				postData.keyArray=["HOT"]
				postData.startIndex=page;
				postData.pageSize=30;
				postData.hot=true
				this.$api.request.goodsList(postData,(res)=>{
					
					// this.guessData=res.body.data.products;
					this.totalni=res.body.data.total;
					this.guessData.push(...res.body.data.products)
					console.log(res.body.data.products)
					this.status = 'loading';
				})
			},
			toTiJiao(msg){
				uni.navigateTo({
					url:'/pages/Design/Design?name='+msg
				})
			},
			// 获取 家，能量无限的图片
			getGlobalApplicationSetting(){
				this.$api.request.getGlobalApplicationSetting({}, res => {
					this.appData=res.body.data
					// console.log(res.body.data)
					for(var i=0;i<8;i++){
						this.iconImglis.push(res.body.data['indexNavIcon'+(i+1)])
					}
					// console.log(this.iconImglis)
				},true);
			},
			// 获取首页栏目设置图片
			getIndexCateSettingList(index){
				
				this.$api.request.getIndexCateSettingList({"type":index}, res => {
					
					if(index==1){
						this.sheJiLanMu=res.body.data.setttings;
						// console.log(this.sheJiLanMu)
					}else{
						this.fangjianlanmu=res.body.data.setttings;
						// console.log(this.fangjianlanmu)
					}
					
				},true);
			},
			navToProduct(tid) {
				uni.navigateTo({
					// url: '/pages/product/list?cateId='+tid+'&cateList='+escape(JSON.stringify(this.cateList))
					url: '/pages/product/list?cateId='+tid
				})
			},
			// #ifdef MP||H5
			//小程序环境下点击搜索框
			navSearch(){
				uni.navigateTo({
					url: '/pages/index/search'
				})
			}
			// #endif
		},
		// #ifndef MP||H5
		// 标题栏input搜索框点击
		onNavigationBarSearchInputClicked: async function(e) {
			// this.$api.msg('点击了搜索框');
			uni.navigateTo({
				url: '/pages/index/search'
			})
		},
		//点击导航栏 buttons 时触发
		onNavigationBarButtonTap(e) {
			const index = e.index;
			if (index === 0) {
				// this.$api.msg('点击了扫描');
				uni.scanCode({
					success:function(res){
						console.log('条码类型：' + res.scanType);
						console.log('条码内容：' + res.result);
						uni.navigateTo({
							url: '/pages/content/webView?src=' + res.result
						})
					}
				})
			} else if (index === 1) {
				// #ifdef APP-PLUS
				const pages = getCurrentPages();
				const page = pages[pages.length - 1];
				const currentWebview = page.$getAppWebview();
				currentWebview.hideTitleNViewButtonRedDot({
					index
				});
				// #endif
				uni.navigateTo({
					url: '/pages/notice/list'
				})
			}
		}
		// #endif
	}
</script>

<style lang="scss">
.index{
	.header{
		// transition: all 0.5s;
		height: 126upx;
		position: fixed;
		left: 0;
		right: 0;
		z-index: 400;
		// background-color: #F6F7F8;
		top: 0;
		box-sizing: content-box;
		.logo{
			position: absolute;
			z-index: 10;
			left: 20upx;
			bottom: 0upx;
			width: 150upx;
		}
	}
	.header_blank{height: 126upx;box-sizing: content-box;}
	.giftbox{
		overflow: hidden;
		margin-bottom: 60upx;
		padding: 0 30upx;
		.t{
			font-size: 38upx;
			color: #000;
			font-weight: 700;
			margin-bottom: 40upx;
		}
		.con{
			overflow: hidden;
			text-align: center;
			image{
				width: 100%;
			}
		}
	}
	.online{
		overflow: hidden;
		margin-bottom: 60upx;
		padding-left: 30upx;
		.t{
			font-size: 38upx;
			color: #000;
			font-weight: 700;
			margin-bottom: 40upx;
			position: relative;
			.more{
				font-size: 28upx;
				font-weight: 400;
				position: absolute;
				top: 10upx;
				right:30upx;
				z-index: 10;
				image{
					display:inline-block;
					width: 8upx;
					height: 15upx;
					vertical-align: middle;
					margin-left: 10upx;
					position: relative;
					top: -1upx;
				}
			}
		}
		.list{
			overflow: hidden;
			white-space: nowrap;
			.item{
				margin-right: 30upx;
				width: 300upx;
				border:#DFDFDF 1px solid;
				box-sizing: border-box;
				border-radius: 8upx;
				overflow: hidden;
				display: inline-block;
				image{
					width: 100%;
					height: 245upx;
					background-color: #eee;
				}
				.name{
					padding: 12upx 24upx;
					font-size: 32upx;
					height: 110upx;
					overflow: hidden;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					text-overflow: ellipsis;
					-webkit-line-clamp: 3;
					white-space: normal;
				}
			}
		}
	}
	.family{
		margin-bottom: 60upx;
		overflow: hidden;
		padding-left: 30upx;
		position: relative;
		.bg{
			position: absolute;
			z-index: 1;
			left: 0;
			margin: auto;
			width: 100%;
			background-color: #878894;
			right: 0;
			top: 0;
			image{
				width: 100%;
				opacity: 0.4;
			}
		}
		.t{
			position: relative;
			z-index: 10;
			font-weight: 700;
			padding: 60upx 25upx 6upx;
			color: #fff;
			font-size: 36upx;
		}
		.subs{
			color: #fff;
			font-size: 28upx;
			margin-bottom: 40upx;
			padding: 0 25upx;
			position: relative;
			z-index: 10;
		}
		.list{
			overflow: hidden;
			white-space: nowrap;
			position: relative;
			z-index: 10;
			.item{
				display: inline-block;
				margin-right: 30upx;
				width: 260upx;
				height: 340upx;
				border-radius: 8upx;
				overflow: hidden;
				image{
					width: 100%;
				}
			}
		}
	}
	.club{
		margin-bottom: 60upx;
		overflow: hidden;
		margin-left: 30upx;
		margin-right: 30upx;
		position: relative;
		.bg{
			position: absolute;
			z-index: 1;
			left: 0;
			margin: auto;
			width: 100%;
			
			right: 0;
			top: 0;
			background: #878894;
			border-radius: 20upx 20upx 0upx 0upx;
			image{
				width: 100%;
				// opacity: 0.4;
			}
		}
		.t{
			position: relative;
			z-index: 10;
			text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.5);
			padding: 50upx 30upx 10upx;
			color: #fff;
			font-size: 36upx;
		}
		.subs{
			color: #fff;
			font-size:32upx;
			margin-bottom: 40upx;
			padding: 0 25upx;
			position: relative;
			z-index: 10;
			text{
				margin-right: 20upx;
			}
			.icon{
				width: 30upx;
				height: 30upx;
				display: inline-block;
				vertical-align: middle;
				position: relative;
				top: -1px;
				margin-right: 10upx;
			}
		}
		.btn{
			width: 105upx;
			height: 105upx;
			border-radius: 100%;
			position: absolute;
			z-index: 100;
			top: 120upx;
			right: 55upx;
			// background-color: #fff;
			color: #000;
			font-size: 40upx;
			font-family: "Roboto Condensed Bold";
			font-weight: 700;
			text-align: center;
			line-height: 93upx;
			image{
				width: 10upx;
				height: 18upx;
				display: inline-block;
				vertical-align: middle;
				position: relative;
				top: -1px;
				margin-left: 5upx;
			}
		}
		.list{
			white-space: nowrap;
			position: relative;
			z-index: 10;
			padding-left: 12upx;
			.item{
				display: inline-block;
				margin-right: 30upx;
				width: 320upx;
				border-radius: 20upx;
				background-color: #fff;
				overflow: hidden;
				line-height: 1.5;
				box-shadow: rgba(0,0,0,0.2) 0 0 20upx;
				margin-bottom: 20upx;
				image{
					width: 100%;
					height: 315upx;
					margin-bottom: 20upx;
				}
			}
			.name{
				font-size: 28upx;
				white-space: nowrap;
				text-overflow: ellipsis;
				overflow: hidden;
				padding: 0 20upx;
				font-weight: 700;
			}
			.spec{
				color: #666;
				white-space: nowrap;
				text-overflow: ellipsis;
				padding: 0 20upx;
				overflow: hidden;
				font-size: 20upx;
			}
			.price{
				color: #000;
				font-weight: 700;
				padding: 0 20upx 10upx;
				font-size: 24upx;
			}
		}
	}
	.service{
		margin-bottom: 60upx;
		overflow: hidden;
		padding: 0 30upx;
		position: relative;
		.t{
			padding-bottom: 7upx;
			font-size: 38upx;
		}
		.subs{
			font-size:28upx;
			margin-bottom: 40upx;
		}
		.con{
			overflow: hidden;
			.left{
				width: 323upx;
				height: 433upx;
				float: left;
				margin-right: 27upx;
				position: relative;
			}
			.right{
				overflow: hidden;
			}
			.pic{
				width: 100%;
				height: 100%;
			}
			.item{
				width: 100%;
				height: 200upx;
				position: relative;
			}
			.item:first-child{
				margin-bottom: 28upx;
			}
			.text{
				position: absolute;
				z-index: 10;
				left: 30upx;
				// bottom: 30upx;
				top:20upx;
				color: #fff;
				font-size: 28upx;
			}
			.icon{
				width: 40upx;
				height: 40upx;
			}
		}
	}
	.brand{
		overflow: hidden;
		margin-bottom: 60upx;
		padding-left: 30upx;
		.t{
			font-size: 38upx;
			color: #000;
			font-weight: 700;
			margin-bottom: 40upx;
			position: relative;
			.more{
				font-size: 28upx;
				font-weight: 400;
				position: absolute;
				top: 10upx;
				right:30upx;
				z-index: 10;
				image{
					display:inline-block;
					width: 8upx;
					height: 15upx;
					vertical-align: middle;
					margin-left: 10upx;
					position: relative;
					top: -1upx;
				}
			}
		}
		.list{
			overflow: hidden;
			white-space: nowrap;
			.item{
				margin-right: 30upx;
				width:260upx;
				height: 230upx;
				box-sizing: border-box;
				border-radius: 8upx;
				overflow: hidden;
				display: inline-block;
				position: relative;
				image{
					width: 100%;
					height: 100%;
					background-color: #666;
				}
				.name{
					background-color: rgba(0, 0, 0, 0.3);
					position: absolute;
					left: 0;
					right: 0;
					top: 0;
					bottom: 0;
					margin: auto;
					padding:0 15upx;
					font-size: 32upx;
					line-height:230upx;
					color: #fff;
					text-align: center;
					overflow: hidden;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					text-overflow: ellipsis;
					white-space: nowrap;
				}
			}
		}
	}
	.like{
		margin-bottom: 60upx;
		overflow: hidden;
		
		position: relative;
		.t{
			font-size: 36upx;
			margin-bottom: 40upx;
			padding: 0 30upx;
			font-weight: 700;
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;
			.t_item{
				display: inline-block;
				margin-right:30upx;
			}
			.t_only{
				color: #4399FC;
				border-bottom: 4upx solid #4399FC;
			}
		}
		.lists{
			padding: 0 20upx;
			.item{
				float: left;
				padding: 0 5upx;
				width: 50%;
				line-height: 1.5;
				margin-bottom: 10upx;
				image{
					width: 100%;
					height: 240upx;
					margin-bottom:10upx;
					background-color: #eee;
				}
			}
			.in{
				overflow: hidden;
				padding: 25upx 30upx;
				background-color: #fff;
				box-shadow: rgba(0,0,0,0.1) 0 0 25upx;
			}
			.name{
				font-size: 32upx;
				white-space: nowrap;
				text-overflow: ellipsis;
				overflow: hidden;
				font-weight: 700;
				margin-bottom: 5upx;
			}
			.spec{
				color: #666;
				white-space: nowrap;
				text-overflow: ellipsis;
				overflow: hidden;
				font-size: 24upx;
			}
			.price{
				color: #000;
				font-weight: 700;
				font-size: 28upx;
			}
			.myCon{
				margin-bottom: 60upx;
				border-radius: 25upx 25upx 0upx 0upx;
				background-color: #fff;
				box-shadow: 5upx 5upx 10upx 5upx #ccc;
				.img{
					height: 480upx;
					// width: 722upx;
					.image{
						width: 100%;
						border-radius: 25upx;
					}
				}
				.text{
					height: 100upx;
					text-align: center;
					line-height: 100upx;
					background-color: #fff;
				}
			}
		}
	}
	
	.part{
		margin-bottom: 60upx;
		overflow: hidden;
		padding: 0 30upx;
		position: relative;
		.t{
			padding-bottom: 7upx;
			font-size: 38upx;
		}
		.subs{
			font-size:28upx;
			margin-bottom: 40upx;
		}
		.top{
			position: relative;
			width: 100%;
			height: 450upx;
			margin-bottom: 20upx;
			.pic{
				width: 100%;
				height: 100%;
			}
			.text{
				position: absolute;
				z-index: 10;
				left: 40upx;
				bottom: 40upx;
				color: #fff;
				font-size: 28upx;
				background-color: #fff;
				width: 174upx;
				height: 160upx;
				box-sizing: border-box;
				padding: 20upx 24upx;
				color: #000;
				font-size: 32upx;
			}
			.icon{
				margin-top: 30upx;
				width: 37upx;
				height: 25upx;
			}
		}
		.list{
			display: flex;
			justify-content: space-between;
			overflow: hidden;
			.item{
				width: 190upx;
				float: left;
				image{
					width: 100%;
					height: 190upx;
					margin-bottom: 10upx;
				}
				.name{
					color: #404040;
					font-size: 24upx;
					text-align: center;

				}
			}
		}
	}
}
	/* #ifdef MP||H5 */
	.mp-search-box {
		transition: all 0.5s ease;
		position: fixed;
		display: flex;
		left: 0;
		right: 0;
		top:126upx;
		z-index: 9999;
		width: 100%;
		padding: 25upx 30upx;
		// background-color: #fff;
		background-color: rgba(255,255,255,0);
		.ser-input {
			flex: 1;
			height: 70upx;
			line-height: 70upx;
			text-align: center;
			font-size: 28upx;
			// color: $font-color-gray;
			border-radius: 35px;
			// background: #F7F8F9;
			text-align: left;
			padding-left: 107upx;
			
			background-color: rgba(0, 0, 0, 0.5);
			border: 2upx #3c3c3c solid;
			color: #FFFFFF;
		}
		.icon{
			transition: all 1s ease;
			width: 27upx;
			height: 27upx;
			display: inline-block;
			position: absolute;
			z-index: 1;
			left: 60upx;
			top: 0;
			bottom: 0;
			margin: auto;
		}
	}
	
	.mp-search-box-blank{
		// height: 120upx;
	}
	
	.op-search {
		transition: all 1s ease;
		position: fixed;
		display: flex;
		height: 150upx;
		left: 0;
		right: 0;
		// top:10upx;
		z-index: 9999;
		width: 100%;
		padding: 25upx 30upx;
		padding-right: 200upx;
		padding-top: 65upx;
		background-color: #fff;
		.ser-input {
			flex: 1;
			height: 70upx;
			line-height: 70upx;
			text-align: center;
			font-size: 28upx;
			color: $font-color-gray;
			border-radius: 35px;
			background: #F7F8F9;
			text-align: left;
			padding-left: 107upx;
			
			
		}
		.icon{
			transition: all 1s ease;
			width: 27upx;
			height: 27upx;
			line-height: 27upx;
			display: inline-block;
			position: absolute;
			z-index: 1;
			left: 60upx;
			top:50upx;
			bottom: 0;
			margin: auto;
		}
	}
	
	
	
	page {
		color: #000;
		.carousel-section {
			padding: 0;

			.titleNview-placing {
				padding-top: 0;
				height: 0;
			}

			.carousel {
				.carousel-item {
					padding: 0;
				}
			}

			.swiper-dots {
				left: 45upx;
				bottom: 40upx;
			}
		}
	}

	/* #endif */


	page {
		background: #fff;
	}

	.m-t {
		margin-top: 16upx;
	}

	/* 头部 轮播图 */
	.carousel-section {
		position: relative;
		padding-top: 10px;

		.titleNview-placing {
			height: var(--status-bar-height);
			padding-top: 44px;
			box-sizing: content-box;
		}

		.titleNview-background {
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height:980upx;
			transition: .4s;
		}
	}

	.carousel {
		width: 100%;
		height:980upx;
		/*margin-bottom: 60upx;*/
		.carousel-item {
			width: 100%;
			height: 100%;
			/*padding: 0 28upx;*/
			overflow: hidden;
		}

		image {
			width: 100%;
			height: 100%;
			/*border-radius: 10upx;*/
		}
	}

	.swiper-dots {
		display: flex;
		position: absolute;
		left: 60upx;
		bottom: 15upx;
		width: 72upx;
		height: 36upx;
		background-image: url();
		background-size: 100% 100%;

		.num {
			width: 36upx;
			height: 36upx;
			border-radius: 50px;
			font-size: 24upx;
			color: #fff;
			text-align: center;
			line-height: 36upx;
		}

		.sign {
			position: absolute;
			top: 0;
			left: 50%;
			line-height: 36upx;
			font-size: 12upx;
			color: #fff;
			transform: translateX(-50%);
		}
	}
	
	.grid-wrapper{
		background-color: #ffffff;
		position: relative;
		z-index: 5;
		border-radius: 16upx 16upx 0 0;
	
	}
	.grid-swiper{
		height: 344upx;
	}
	.grid-item-box {
		flex: 1;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
	}
	
	.grid-image{
		width: 80upx;
		height: 80upx;
	}
	.grid-text{
		color: $font-color-dark;
		font-size: $font-sm;
	}
	.grid-dot {
		position: absolute;
		top: 5px;
		right: 15px;
	}

	.ad-1 {
		width: 100%;
		height: 210upx;
		padding: 10upx 0;
		background: #fff;

		image {
			width: 100%;
			height: 100%;
		}
	}

	/* 秒杀专区 */
	.seckill-section {
		padding: 4upx 30upx 24upx;
		background: #fff;

		.s-header {
			display: flex;
			align-items: center;
			height: 92upx;
			line-height: 1;

			.s-img {
				width: 140upx;
				height: 30upx;
			}

			.tip {
				font-size: $font-base;
				color: $font-color-light;
				margin: 0 20upx 0 40upx;
			}

			.countdown {
				margin: 0 20upx 0 40upx;
			}

			.timer {
				display: inline-block;
				width: 40upx;
				height: 36upx;
				text-align: center;
				line-height: 36upx;
				margin-right: 14upx;
				font-size: $font-sm+2upx;
				color: #fff;
				border-radius: 2px;
				background: rgba(0, 0, 0, .8);
			}
			.end{
				font-size: 12px;
				margin-left: 20px;
				background-color: #333;
				color: #fff;
				padding: 5px;
				border-radius: 5px;
			}

			.icon-you {
				font-size: $font-lg;
				color: $font-color-light;
				flex: 1;
				text-align: right;
				margin-left: auto;
			}
		}

		.floor-list {
			white-space: nowrap;
		}

		.scoll-wrapper {
			display: flex;
			align-items: flex-start;
		}

		.floor-item {
			width: 150upx;
			margin-right: 20upx;
			font-size: $font-sm+2upx;
			color: $font-color-dark;
			line-height: 1.8;

			image {
				width: 150upx;
				height: 150upx;
				border-radius: 6upx;
			}

			.price {
				color: $uni-color-primary;
			}
		}
	}

	.f-header {
		display: flex;
		align-items: center;
		height: 140upx;
		padding: 6upx 30upx 8upx;
		background: #fff;

		image {
			flex-shrink: 0;
			width: 80upx;
			height: 80upx;
			margin-right: 20upx;
		}

		.tit-box {
			flex: 1;
			display: flex;
			flex-direction: column;
		}

		.tit {
			font-size: $font-lg +2upx;
			color: #font-color-dark;
			line-height: 1.3;
		}

		.tit2 {
			font-size: $font-sm;
			color: $font-color-light;
		}

		.icon-you {
			font-size: $font-lg +2upx;
			color: $font-color-light;
		}
	}

	/* 团购楼层 */
	.group-section {
		background: #fff;

		.g-swiper {
			height: 650upx;
			padding-bottom: 30upx;
		}

		.g-swiper-item {
			width: 100%;
			padding: 0 30upx;
			display: flex;
		}

		image {
			width: 100%;
			height: 460upx;
			border-radius: 4px;
		}

		.g-item {
			display: flex;
			flex-direction: column;
			overflow: hidden;
		}

		.left {
			flex: 1.2;
			margin-right: 24upx;

			.t-box {
				padding-top: 20upx;
			}
		}

		.right {
			flex: 0.8;
			flex-direction: column-reverse;

			.t-box {
				padding-bottom: 20upx;
			}
		}

		.t-box {
			height: 160upx;
			font-size: $font-base+2upx;
			color: $font-color-dark;
			line-height: 1.6;
		}

		.price {
			color: $uni-color-primary;
		}

		.m-price {
			font-size: $font-sm+2upx;
			text-decoration: line-through;
			color: $font-color-light;
			margin-left: 8upx;
		}

		.pro-box {
			display: flex;
			align-items: center;
			margin-top: 10upx;
			font-size: $font-sm;
			color: $font-base;
			padding-right: 10upx;
		}

		.progress-box {
			flex: 1;
			border-radius: 10px;
			overflow: hidden;
			margin-right: 8upx;
		}
	}

	/* 分类推荐楼层 */
	.hot-floor {
		width: 100%;
		overflow: hidden;
		margin-bottom: 20upx;

		.floor-img-box {
			width: 100%;
			height: 320upx;
			position: relative;

			&:after {
				content: '';
				position: absolute;
				left: 0;
				top: 0;
				width: 100%;
				height: 100%;
				background: linear-gradient(rgba(255, 255, 255, .06) 30%, #f8f8f8);
			}
		}

		.floor-img {
			width: 100%;
			height: 100%;
		}

		.floor-list {
			white-space: nowrap;
			padding: 20upx;
			padding-right: 50upx;
			border-radius: 6upx;
			margin-top: -140upx;
			margin-left: 30upx;
			background: #fff;
			box-shadow: 1px 1px 5px rgba(0, 0, 0, .2);
			position: relative;
			z-index: 1;
		}

		.scoll-wrapper {
			display: flex;
			align-items: flex-start;
		}

		.floor-item {
			width: 180upx;
			margin-right: 20upx;
			font-size: $font-sm+2upx;
			color: $font-color-dark;
			line-height: 1.8;

			image {
				width: 180upx;
				height: 180upx;
				border-radius: 6upx;
			}

			.price {
				color: $uni-color-primary;
			}
		}

		.more {
			display: flex;
			align-items: center;
			justify-content: center;
			flex-direction: column;
			flex-shrink: 0;
			width: 180upx;
			height: 180upx;
			border-radius: 6upx;
			background: #f3f3f3;
			font-size: $font-base;
			color: $font-color-light;

			text:first-child {
				margin-bottom: 4upx;
			}
		}
	}
/* 商品列表 */
	.goods-list{
		display:flex;
		flex-wrap:wrap;
		padding: 30upx 30upx;
		background: #fff;
		.goods-item{
			display:flex;
			flex-direction: column;
			width: 48%;
			padding-bottom: 40upx;
			&:nth-child(2n+1){
				margin-right: 4%;
			}
		}
		.image-wrapper{
			width: 100%;
			height: 330upx;
			border-radius: 3px;
			overflow: hidden;
			image{
				width: 100%;
				height: 100%;
				opacity: 1;
			}
		}
		.title{
			font-size: $font-base;
			color: $font-color-dark;
			line-height: 80upx;
		}
		.price-box{
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding-right: 10upx;
			font-size: 24upx;
			color: $font-color-light;
		}
		.price{
			font-size: $font-lg;
			color: $uni-color-primary;
			line-height: 1;
			&:before{
				content: '￥';
				font-size: 26upx;
			}
		}
		.merchant{
			margin-top: 20upx;
			color: $font-color-light;
		}
	}
	//新人福利
	.gift{
		margin: 30% 17% 10% 17%;
		padding: 15px;
		background-color: #B42A28;
		border-radius: 10px;
		.gift-title{
			color: #FCCB90;
			font-size: $font-base;
			font-weight: 700;
			text-align: center;
		}
		.gift-desc{
			color: #FCCB90;
			font-size: $font-sm;
			text-align: center;
		}
		.gift-image{
			margin-top: 10px;
			text-align: center;
			image{
				width: 75px;
				height: 75px;
			}
		}
			
		.gift-content{
			margin-top: 20px;
			.gift-item{
				background-color: #F5D5A2;
				padding:10px;
				margin-top: 10px;
				height: 35px;
				display: flex;
				justify-content: space-between;
				align-items: center;
				.gift-item-label{
					color:#C12E25;
					font-size: $font-sm;
				}
				.gift-item-value{
					text-align: center;
					button{
						background-color: #B42A28;
						color: #FBC78F;
						font-size: $font-base;
						height: 30px;
						line-height: 30px;
						.tip{
							&:after{
								content:'积分';
								font-size: $font-sm;
							}
						}
					}
				}	
			}
		}
		.gift-message{
			margin-top: 10px;
			color: #F8C180;
			font-size: $font-base;
			text-align: center;
		}
		.gift-action{
			margin-top: 30px;
			text-align: center;
			button{
				background-color: #F8C180;
				color: #7B4F15;
				height: 35px;
				line-height: 35px;
				font-size: $font-base;
				font-weight: 700;
			}
		}
	}
	.gift-close{
		display: flex;
		justify-content: center;
		margin-top: 20px;
	}
	
	
	
</style>
